package com.ls.pattern.behavior.strategy;

public abstract class Duck {
    FlyBehavior flyBehavior;
    QuackBehavior quackBehavior;
    public Duck() {

    }

    //显示鸭子信息
    public abstract void display();

    public void quack() {
        if (quackBehavior != null){
            quackBehavior.quack();
        }
    }

    public void fly() {
        if (flyBehavior != null){
            flyBehavior.fly();
        }

    }

}
